Skip to content

Conversation

Esurnir
Copy link

@Esurnir Esurnir commented Sep 19, 2025

Summary

The increment and decrement static operator currently are no-op. This fix ensure they actually do increment and decrement the value of the numerator in the fraction.

Change the operator from an increment to a non mutating operand.numerator + 1 because otherwise the call to a reference version of Fraction would result in Console.WriteLine(a++); to print a after its mutation instead of the before value.

Fixes #48626

@Esurnir Esurnir requested review from BillWagner and a team as code owners September 19, 2025 16:58
@dotnetrepoman dotnetrepoman bot added this to the September 2025 milestone Sep 19, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-csharp/svc lang-reference/subsvc community-contribution Indicates PR is created by someone from the .NET community. labels Sep 19, 2025
The increment and decrement static operator currently are no-op. This fix ensure they actually do increment and decrement the value of the numerator in the fraction.

Change the operator from an increment to a non mutating operand.numerator + 1 because otherwise the call to a reference version of Fraction would result in `Console.WriteLine(a++);` to print a after its mutation instead of the before value.

Fixes dotnet#48626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc lang-reference/subsvc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

static increment/decrement operator do not work properly in code snippet
1 participant